package com.caiya.cart;

/**
 * Created by Administrator on 2018/11/26 0026.
 */
public class Res {
    /**
     * 接口业务正常执行状态标识
     */
    public static final Integer CODE_SUCCESS = 1;

    /**
     * 接口业务执行失败标识
     */
    public static final Integer CODE_FAIL = 0;

    /**
     * 业务执行结果
     */
    private Integer code;

    /**
     * 提示信息
     */
    private String msg;

    /**
     * 接口响应具体业务数据
     */
    private Object data;

    /**
     * 请求成功，有业务数据，默认为接口成功
     * @param data
     */
    public Res(Object data) {
        this.code = CODE_SUCCESS;
        this.msg = "ok";
        this.data = data;
    }

    public Res(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Res() {
    }

    public static Integer getCodeSuccess() {
        return CODE_SUCCESS;
    }

    public static Integer getCodeFail() {
        return CODE_FAIL;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
